package com.rain.cy.business.handler.base;

import cn.hutool.json.JSONUtil;
import com.rain.cy.business.model.dto.UserProcessDataDTO;
import com.rain.cy.business.model.json.BaseProcessDataJson;

/**
 * @author richrain.cy
 * @date 2021/10/21 7:54 下午
 */
public abstract class BaseProcessHandler implements ProcessHandler {

    /**
     * 初始化dataJson数据
     *
     * @return BaseProcessDataJson
     */
    public abstract BaseProcessDataJson initProcessDataJson();

    @Override
    public void handler(UserProcessDataDTO userProcessDataDTO) {

    }

    @Override
    public void queryHandler(UserProcessDataDTO userProcessDataDTO) {
        BaseProcessDataJson baseProcessDataJson = initProcessDataJson();
        userProcessDataDTO.setBaseProcessDataJson(baseProcessDataJson);
        userProcessDataDTO.setProcessData(JSONUtil.toJsonStr(baseProcessDataJson));
    }

}
